"""
医疗场景管理器
"""

from typing import Dict, List, Optional, Any
from medical_scenes.scenes.lung_nodule.processor import LungNoduleProcessor

class MedicalSceneManager:
    """医疗场景管理器"""
    
    def __init__(self):
        """初始化场景管理器"""
        self.processors = {
            "lung-nodule": LungNoduleProcessor()
        }
    
    def get_scene(self, scene_id: str):
        """
        获取指定场景的处理器
        
        Args:
            scene_id: 场景ID
            
        Returns:
            场景处理器实例
        """
        return self.processors.get(scene_id)
    
    def list_scenes(self) -> List[Dict[str, str]]:
        """
        列出所有可用场景
        
        Returns:
            场景列表
        """
        scenes = []
        for scene_id, processor in self.processors.items():
            scenes.append({
                "id": scene_id,
                "name": processor.name,
                "description": processor.description
            })
        return scenes
    
    def process_scene(self, scene_id: str, image_data: str, **kwargs) -> Dict[str, Any]:
        """
        处理场景
        
        Args:
            scene_id: 场景ID
            image_data: 图像数据
            **kwargs: 处理参数
            
        Returns:
            处理结果
        """
        processor = self.get_scene(scene_id)
        if not processor:
            raise ValueError(f"Scene '{scene_id}' not found")
        
        if not processor.validate_input(image_data):
            raise ValueError("Invalid image data")
        
        return processor.process(image_data, **kwargs)